package com.example.smartcanteen.controller;

import com.example.smartcanteen.model.ShopCart;
import com.example.smartcanteen.service.ShopCartService;
import com.example.smartcanteen.utils.ResponseMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/shopCart")
@CrossOrigin
public class ShopCartController {
    @Autowired
    private ShopCartService shopCartService;


    //所需数据：int studentID；
    @PostMapping("/select")
    ResponseMessage select(int studentID) {


        return shopCartService.select(studentID);
    }


    //
    @PostMapping("/joinGoods")
    ResponseMessage joinGoods(ShopCart shopCart){


        return shopCartService.joinGoods(shopCart);
    }


    //所需数据：int studentID；
    @PostMapping("/createOrder")
    ResponseMessage createOrder(int studentID,int shopID,int count,double price,String payment,String form,int goodsID) {


        return shopCartService.createOrder(studentID,shopID,count,price,payment,form,goodsID);
    }
}
